import request from './index.js'

// 获取门店列表
export function getStoreList(params) {
  return request({
    url: '/store/list',
    method: 'get',
    params
  })
}

// 获取门店详情
export function getStoreDetail(id) {
  return request({
    url: `/store/${id}`,
    method: 'get'
  })
}

// 获取附近门店
export function getNearbyStores(latitude, longitude, radius) {
  return request({
    url: '/store/nearby',
    method: 'get',
    params: {
      latitude,
      longitude,
      radius
    }
  })
}

// 根据省市获取门店
export function getStoresByLocation(province, city) {
  return request({
    url: '/store/location',
    method: 'get',
    params: {
      province,
      city
    }
  })
}

// 导出门店相关API
export const storeApi = {
  getStoreList,
  getStoreDetail,
  getNearbyStores,
  getStoresByLocation
} 